/*
 * @Author: typ
 * @Date: 2025-01-15 10:36:43
 * @LastEditors: typ
 * @LastEditTime: 2025-02-18 15:49:54
 * @FilePath: /720Manage-vite/src/api/model.js
 * @Description: 
 */
import request from "@/utils/request";

// 获取模型列表
export function getModelList(params) {
  return request({
    url: "modelGenerationCreate/model/list",
    method: "get",
    params,
  });
}

// 获取模型
export function getModel(params) {
  return request({
    url: "modelGenerationCreate/model/url",
    method: "get",
    params,
  });
}

// 模型生成任务
export function getModelTaskList(params) {
  return request({
    url: "modelGenerationCreateTask/task/list",
    method: "get",
    params,
  });
}

// 获取模型任务详情
export function getModelTaskById(id) {
  return request({
    url: `modelGenerationCreateTask/task/${id}`,
    method: "get",
  });
}

// 根据模型id获取模型
export function getModelById(id) {
  return request({
    url: `modelGenerationCreate/model/id/${id}`,
    method: "get",
  });
}

// 根据任务id获取模型
export function getModelByTaskId(id) {
  return request({
    url: `modelGenerationCreate/model/taskId/${id}`,
    method: "get",
  });
}

// 上传照片生成模型
export function uploadModelPictrue(data) {
  return request({
    url: "/modelGenerationCreateTask/task/postPictrueToMino",
    method: "post",
    data,
  });
}

// 删除模型任务
export function delModelTask(id) {
  return request({
    url: `modelGenerationCreateTask/task/${id}/cancel`,
    method: "delete",
  });
}

// 删除模型
export function delModel(ids) {
  return request({
    url: `modelGenerationCreate/batch/${ids}`,
    method: "delete",
  });
}

// 开始处理生成模型
export function startModelTask(data) {
  return request({
    url: "modelGenerationCreateTask/task/postPictrueAndCreateModel",
    method: "post",
    data,
  });
}

// 直接上传模型
export function uploadDronePanorama(query, data, onUploadProgress) {
  return request({
    url: "/modelGenerationCreateTask/task/drone-uploadDronePanorama?" + query,
    method: "post",
    data,
    onUploadProgress,// 上传进度回调
  });
}

// 获取mino地址
export function getMinoUrl(originalName) {
  return request({
    url: `modelGenerationCreate/model/url`,
    method: "get",
    params: { originalName }
  });
}

// 获取文件权限
export function getFileQX(folderPrefix) {
  return request({
    url: `modelGenerationCreate/model/setPolicy`,
    method: "get",
    params: { folderPrefix }
  });
}



// 发布模型
export function publishModel(id) {
  return request({
    url: `modelGenerationCreate/model/${id}/publish`,
    method: "post",
  });
}

// 取消发布模型
export function CanceldPublishModel(id) {
  return request({
    url: `modelGenerationCreate/model/${id}/canceld`,
    method: "post",
  });
}

// 查询进度
export function queryProgress(taskId) {
  return request({
    url: `modelGenerationCreateTask/task/${taskId}`,
    method: "get",
  });
}